package chapter06.e14;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class E14 {
    public static void main(String[] args) {
        HashMap map = new HashMap();
        map.put("刘雯", "杨思琪");
        map.put("1", "张三");
        map.put("2", "李四");
        map.put("3", "王五");
        System.out.println(map);
        //使用迭代器 取出所有数据
        Set keySet = map.keySet();
        Iterator it = keySet.iterator();
        while (it.hasNext()) {
            Object key = it.next();
            System.out.println(key + " : " + map.get(key));
        }
    }
}
